<!-- 内部iframe页面 -->
<template>
  <div v-loading="loading" element-loading-text="正在加载页面，请稍候！">
    <iframe :id="iframeId" style="width: 100%; height: 100%" :src="src" frameborder="no"></iframe>
  </div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue'
const props = defineProps<{
  src: string,
  iframeId: string,
}>()
const loading = ref(false)
onMounted(() => {
  var _this = this;
  const iframeId = ("#" + props.iframeId).replace(/\//g, "\\/");
  const iframe = document.querySelector(iframeId) as HTMLIFrameElement;
  // iframe页面loading控制
  loading.value = true;
  if (iframe) {
    iframe.onload = function () {
      loading.value = false
    };
  }
})
</script>
